Skip to content

Render supersedes and replaced-by notes for deprecations - #189

Merged
floydtree merged 1 commit into
ocsf:mainfrom
floydtree:cross-mkarking-deprecation
Jul 30, 2026
Merged

floydtree merged 1 commit into
ocsf:mainfrom
floydtree:cross-mkarking-deprecation

Conversation

@floydtree

Copy link
Copy Markdown
Contributor

Summary

Surfaces deprecation replacements in the schema browser, in both directions.

The OCSF @deprecated block now carries a superseded_by array naming the replacement definition(s), and the schema compiler derives a reverse _supersedes marker on each replacement in browser mode. This PR renders both:

  • "Supersedes deprecated X" on a live definition — so anyone landing on the replacement can see what it took over from.
  • "Replaced by X" on a deprecated attribute whose replacement lives in a different container — so consumers migrating off it can find where it went, without hunting through other pages.

Depends on the schema-side and compiler-side changes (see Related below). Renders nothing when the marker is absent, so it is a no-op against a schema compiled without them.

Changes

page_view.ex

  • format_item_supersedes/3 — the note for a whole class or object, linking each superseded item to its page.
  • append_supersedes/2 — the note for an attribute.
  • format_enum_supersedes/2 — the note for an enum value, resolving the deprecated value's caption for display alongside its key.
  • append_superseded_by/3 — the forward "Replaced by" note. Only dotted paths (e.g. job_action.cmd_line) get a link, since same-context replacements are already covered by the reverse note. The link targets the container page, resolving classes vs objects via Schema.class/1.
  • format_attribute_desc/3 and format_dictionary_attribute_desc/3 take an optional conn to build those links. It defaults to nil, and append_superseded_by/3 returns the html untouched in that case, so any caller that doesn't pass it keeps working.

schema.ex / page_controller.ex — the classes listing page went through clean_classes_filter_extensions/1. Utils.filter_internal/1 strips every _-prefixed key, so _supersedes never reached the template. Adds classes_filter_extensions/1 and points the page at it, mirroring objects_filter_extensions/1, which the objects listing page already uses for the same reason.

Note on the controller: the previous path applied attribute-level profile filtering via clean_classes_filter_extensions_profiles/2. Dropping it is not a regression and brings classes/2 to parity with objects/2 — filter_items_attributes_by_profiles/2 filters only attributes, and the classes listing renders no attribute rows. The per-row profile data driving the client-side filter comes from class[:profiles], which is untouched.

data_types.html.eex — links out to the OCSF storage strategies data type mappings article.

components.css — styles both notes (accent color for supersedes, warning color for replaced-by), with dark-theme variants.

Bumps version to 4.5.0.

Testing

mix compile clean (the unused require Logger warning in lib/schema.ex is pre-existing on main). mix format --check-formatted reports the same three files as main does; no new findings, and the formatter's suggestions fall entirely on pre-existing lines.

Ran the server against a browser-mode compile of ocsf-schema and verified every rendering surface:

Surface Verified
Class page _supersedes note above the attribute table
Object page e.g. finding_info → links to finding
Classes listing 10 notes, matching the compiled count
Objects listing 3 notes, matching the compiled count
Attribute rows 179 across class/object/profile pages
Dictionary 36 supersedes, 12 replaced-by
Enum value win/reg_value type_id 8 → REG_QWORD_LITTLE_ENDIAN [9]
Profile page incident, data_classification, network_proxy
Cross-container links 23, e.g. job.cmd_line → /objects/job_action
Data types page storage strategies link present

Also spot-checked /, /classes, /objects, /dictionary, /data_types, /profiles, /categories, /classes/authentication, /objects/user — all 200, and /base_event 302 as expected. Multi-item notes render comma-separated (e.g. cis_benchmark, plus others).

Marker counts match the compiler output exactly in every case, confirming nothing is dropped between compile and render.

Related

The OCSF schema's @deprecated block now carries a "superseded_by" array
naming the replacement definition(s), and the schema compiler derives a
reverse ":_supersedes" marker on each replacement in browser mode. This
surfaces both directions in the browser so consumers migrating off a
deprecated definition can find its replacement, and anyone landing on a
replacement can see what it supersedes.

- page_view: adds format_item_supersedes/3 for classes and objects,
  append_supersedes/2 for attributes, and format_enum_supersedes/2 for
  enum values. Each renders a "Supersedes deprecated X" note, linking to
  the deprecated item's page where one exists.
- page_view: adds append_superseded_by/3, rendering a "Replaced by" note
  on a deprecated attribute whose replacement lives in another container.
  Only dotted paths (e.g. "job_action.cmd_line") get a forward link;
  same-context replacements are covered by the reverse note instead.
  format_attribute_desc/3 and format_dictionary_attribute_desc/3 take an
  optional conn to build those links, defaulting to nil so existing
  callers keep working.
- schema, page_controller: the classes listing page went through
  clean_classes_filter_extensions/1, whose filter_internal/1 strips all
  "_"-prefixed keys and so removed :_supersedes. Adds
  classes_filter_extensions/1 and switches the page to it, mirroring how
  the objects listing page already works. Attribute-level profile
  filtering is not applied, matching objects/2; the listing renders no
  attribute rows, and per-row profile data for the client-side filter
  comes from class[:profiles], which is unaffected.
- data_types: links out to the OCSF storage strategies data type
  mappings article.
- components.css: styles both notes, with dark-theme variants.

Bump version to 4.5.0.

Verified against a browser-mode compile of ocsf-schema: 10 class, 3
object, 179 attribute and 1 enum supersedes notes, plus 23 cross-
container replaced-by links, all rendering on the class, object, listing,
dictionary and profile pages.

Signed-off-by: Rajas Panat <rajaspa@amazon.com>
@floydtree
floydtree merged commit 016a712 into ocsf:main Jul 30, 2026
1 check passed
@floydtree
floydtree deleted the cross-mkarking-deprecation branch July 30, 2026 00:40
floydtree added a commit to ocsf/ocsf-schema that referenced this pull request Jul 30, 2026
#### Related Issue:
N/A — discussed in maintainer conversations; see Description.

#### Description of changes:
Today, the replacement for a deprecated item exists only as free text in
the @deprecated.message string (e.g. "Use the <code>application</code>
attribute instead."). The phrasing is inconsistent across the schema and
not machine-readable, so tooling (including the schema browser) cannot
reliably cross-reference a deprecated item with its successor.

This PR introduces a required, machine-readable superseded_by field
inside every @deprecated annotation, and backfills it across the entire
schema.

1. Backfill — all 126 @deprecated annotations now carry superseded_by
2. Message normalization (accuracy fixes to existing text, no semantic
changes)
3. Updates to the contribution guide.

---
#### What consumes this:
The schema compiler (browser mode) resolves superseded_by into
cross-reference markers so the schema browser can render, by default, a
"Supersedes ..." note on the replacement and a "Replaced by ..." link on
the deprecated item. Those changes are in companion PRs to
ocsf-schema-compiler and ocsf-server; this PR is self-contained and
backward-compatible for consumers that ignore unknown @deprecated
fields.

#### Related PRs

1. #1708 - metaschema
2. ocsf/ocsf-validator#39 - validator
3. ocsf/ocsf-schema-compiler#19 - compiler
4. ocsf/ocsf-server#189 - server

---------

Signed-off-by: Rajas Panat <rajaspa@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants